package com.tycmc.signelectroniccontracts.act.renzheng;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.tycmc.signelectroniccontracts.R;
import com.tycmc.signelectroniccontracts.logic.renzheng.PreFirstName;
import com.tycmc.signelectroniccontracts.tools.base.ActBase;
import com.tycmc.signelectroniccontracts.tools.manager.StatusBarCompat;
import com.tycmc.signelectroniccontracts.tools.other.TextShow;
import com.tycmc.signelectroniccontracts.tools.store.SharePre;
import com.tycmc.signelectroniccontracts.tools.store.SharePreName;

public class ActFirstName extends ActBase implements PreFirstName.FirstNameInterface {

    private PreFirstName pre;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        StatusBarCompat.setStstus(this, false);
        transparentStatusbar();
        setContentView(R.layout.act_first_name);
        pre = new PreFirstName(this);
        initView();
    }

    private void initView() {
        findViewById(R.id.tv_shimingrenzhen).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (SharePre.getString(SharePreName.clientTypeID, "01").equals("01")) {
                    pre.startGeren();
                } else {
                    start(new Intent(ActFirstName.this, ActQiyeRenZheng.class));
                }

            }
        });
    }

    @Override
    public void renzhenStyle(boolean name) {
        ((ImageView) findViewById(R.id.ll_top_back)).setImageResource(name ? R.drawable.gerenrenzheng : R.drawable.qiyerenzhenghead);
        ((TextView) findViewById(R.id.tv_tishi)).setText(name ? "请确保输入待认证用户本人信息的真实性" : "请确保输入待认证企业的真实性");
    }

    @Override
    public void initData(String modile, String modiletype) {
        ((TextView) findViewById(R.id.tv_phone_number)).setText(modile);
        ((TextView) findViewById(R.id.tv_norenzheng)).setText(modiletype);
    }
    @Override
    public void sendRenlianshibie(String clientName, String idcNo) {
        if(TextShow.isEmpty(clientName)||TextShow.isEmpty(idcNo)){
            start(new Intent(this, ActPeopleRenzhen.class));
            return;
        }
        pre.huotijiance(clientName, idcNo);
    }
}
